package com.itheima.controller.admin;

import com.itheima.common.result.Result;
import com.itheima.dto.YddUserPageDTO;
import com.itheima.pojo.YddUser;
import com.itheima.service.YddUserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/ydd_user")
@Api(tags = "用户管理")
public class YddUserController {
    @Autowired
    YddUserService yddUserService;

    @GetMapping("list")
    public Result userList(YddUserPageDTO dto){
        return yddUserService.userList(dto);
    }

    @GetMapping("rowInfo")
    public Result rowInfo(Integer id){
        return yddUserService.rowInfo(id);
    }
    @PostMapping("add")
    public Result add(@RequestBody YddUser user){
        return yddUserService.add(user);
    }

    @PostMapping("update")
    public Result update(@RequestBody YddUser user){
        return yddUserService.yddUserUpdate(user);
    }

    @GetMapping("del")
    public Result del(Integer id){
        return yddUserService.del(id);
    }
}
